﻿<UserControl x:Class="ContactTracing.CaseView.Controls.ContactEntryForm"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:p="clr-namespace:ContactTracing.CaseView.Properties"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             IsEnabled="{Binding IsWaitingOnOtherClients, Converter={StaticResource BooleanInverter}}"
             mc:Ignorable="d" 
             d:DesignHeight="700" d:DesignWidth="1200" Loaded="UserControl_Loaded">
    <UserControl.Resources>
        <Thickness x:Key="margin" Left="0" Top="2" Bottom="2" Right="0" />
        <Style TargetType="TextBox" x:Key="DefaultTextBoxStyle">
            <Setter Property="IsReadOnly" Value="True" />
            <Setter Property="BorderBrush" Value="Black" />
            <Setter Property="BorderThickness" Value="0, 0, 0, 1" />
        </Style>

        <Style TargetType="TextBox" x:Key="FullTextBoxStyle">
            <Setter Property="IsReadOnly" Value="True" />
            <Setter Property="BorderBrush" Value="Black" />
            <Setter Property="BorderThickness" Value="1" />
        </Style>
    </UserControl.Resources>

    <Border BorderBrush="{StaticResource AccentBrush}" BorderThickness="1" Background="{StaticResource LightBackgroundBrush}"
            Padding="20">
        <Grid Margin="-11,-1,11,1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition x:Name="col1" Width="Auto" MinWidth="540" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>

            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
                <RowDefinition Height="Auto" />

            </Grid.RowDefinitions>

            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top" Grid.ColumnSpan="4">
                <Button Style="{StaticResource PanelCloseButtonStyle}"  Click="btnClose_Click" />
            </StackPanel>

            <StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="1">
                <Rectangle HorizontalAlignment="Left" Width="100" Height="6" Fill="{StaticResource AccentBrush}" />
                <TextBlock FontSize="24" Foreground="#444444" FontWeight="Bold" Text="{x:Static p:Resources.ContactFormTitle}" />
            </StackPanel>
            <!--<TextBlock Style="{StaticResource Heading1}" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="1"
                       Text="{x:Static p:Resources.ContactFormTitle}"/>-->

            <ScrollViewer Grid.Row="1" Grid.Column="0" x:Name="svPrimary" Visibility="Visible" HorizontalAlignment="Stretch" >
                <StackPanel Margin="0, 0, 10, 0">
                    <StackPanel>
                        <TextBlock Margin="0, 10, 0, 4" x:Name="tblockSourceCase" Style="{StaticResource Heading2}"
                           Text="{x:Static p:Resources.ContactFormSourceCaseInfo}" />

                        <Grid x:Name="gridSourceCase">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="10" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>

                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />

                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>

                            <TextBlock Grid.Column="0" Grid.Row="0" Text="{x:Static p:Resources.ContactFormSourceCaseID}" />
                            <TextBlock Grid.Column="0" Grid.Row="1" Text="{x:Static p:Resources.ContactFormSourceCaseName}" />
                            <TextBlock Grid.Column="0" Grid.Row="2" Text="{x:Static p:Resources.DateLastContact}" />

                            <TextBox Margin="0,2,0,0" IsEnabled="False" x:Name="txtCaseID" Grid.Column="2" HorizontalAlignment="Left" Grid.Row="0" Width="100" Height="18" VerticalAlignment="Top" />
                            <TextBox Margin="{StaticResource margin}" IsEnabled="False" x:Name="txtCaseName" Grid.Column="2" HorizontalAlignment="Left" Grid.Row="1" Width="160" />
                            <TextBox Margin="{StaticResource margin}" IsEnabled="False" x:Name="txtDateContact" Grid.Column="2" HorizontalAlignment="Left" Grid.Row="2" Width="100" />
                        </Grid>

                        <TextBlock Margin="0, 10, 0, 4" Style="{StaticResource Heading2}"
                           Text="{x:Static p:Resources.ContactFormContactInformation}" />

                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="10" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>

                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>

                            <TextBlock x:Name="tblockContactID" Grid.Column="0" Grid.Row="0" Text="{x:Static p:Resources.ID}" />
                            <TextBlock Grid.Column="0" Grid.Row="1" Text="{x:Static p:Resources.ContactFormSurname}" />
                            <TextBlock Grid.Column="0" Grid.Row="2" Text="{x:Static p:Resources.PrintedFormPatientOtherNames}" />
                            <TextBlock Grid.Column="0" Grid.Row="3" Text="{x:Static p:Resources.PrintedFormGender}" />
                            <TextBlock Grid.Column="0" Grid.Row="4" Text="{x:Static p:Resources.PrintedFormAge}" />
                            <TextBlock Grid.Column="0" Grid.Row="5" Text="{x:Static p:Resources.PrintedFormHeadHousehold}" />
                            <TextBlock x:Name="tblockVillageRes" Grid.Column="0" Grid.Row="8" Text="{x:Static p:Resources.ContactFormVillage}" />
                            <TextBlock x:Name="tblockDistrictRes" Grid.Column="0" Grid.Row="6" Text="{x:Static p:Resources.PrintedFormDistrictRes}" />
                            <TextBlock x:Name="tblockSCRes" Grid.Column="0" Grid.Row="7" Text="{x:Static p:Resources.PrintedFormSubCountyRes}" />
                            <TextBlock Grid.Column="0" Grid.Row="9" Text="{x:Static p:Resources.HTMLLC1ChairmanHeading}" />
                            <TextBlock Grid.Column="0" Grid.Row="10" Text="{x:Static p:Resources.ContactFormPhone}" />
                            <TextBlock Grid.Column="0" Grid.Row="11" Text="{x:Static p:Resources.ContactFormHCW}" />
                            <TextBlock Grid.Column="0" Grid.Row="12" Text="{x:Static p:Resources.ContactFormHCWFacility}" />
                            <TextBlock x:Name="tbTeam" Grid.Column="0" Grid.Row="13" Text="{x:Static p:Resources.ContactFormContactTracingTeam}" />
                            <TextBlock Grid.Column="0" Grid.Row="14"  Visibility="Collapsed" Text="{x:Static p:Resources.ContactFormRiskLevel}" />
                            <StackPanel Grid.Column="0" Grid.Row="15" Grid.ColumnSpan="3" Margin="0, 0, 0, 6">
                                <!--<TextBlock Text="Guidelines" FontWeight="Bold" TextDecorations="Underline" FontStyle="Italic" />
                            <TextBlock x:Name="tblockIns1" Text="{x:Static p:Resources.ContactFormRiskInstruction1}" TextWrapping="Wrap" FontStyle="Italic" />
                            <TextBlock x:Name="tblockIns2" Text="{x:Static p:Resources.ContactFormRiskInstruction2}" TextWrapping="Wrap" FontStyle="Italic" />
                            <TextBlock x:Name="tblockIns3" Text="{x:Static p:Resources.ContactFormRiskInstruction3}" TextWrapping="Wrap" FontStyle="Italic" />-->
                            </StackPanel>
                            <TextBlock Grid.Column="0" Grid.Row="16" Text="{x:Static p:Resources.ContactFormFinalOutcome}" />

                            <TextBox Margin="{StaticResource margin}" x:Name="txtContactID" Grid.Column="2" HorizontalAlignment="Left" IsEnabled="False"  Grid.Row="0" Width="60" />

                            <TextBox Margin="{StaticResource margin}" x:Name="txtSurname" Grid.Column="2" HorizontalAlignment="Left" Grid.Row="1" Width="160" />
                            <TextBox Margin="{StaticResource margin}" x:Name="txtOtherNames" Grid.Column="2" HorizontalAlignment="Left" Grid.Row="2" Width="160" />
                            <!--<ComboBox Margin="0, 2, 0, 2" x:Name="cmbGender" Grid.Column="2" IsEditable="True" HorizontalAlignment="Left" Grid.Row="2" Width="120" />-->
                            <StackPanel Margin="{StaticResource margin}" Grid.Column="2" Grid.Row="3" Orientation="Horizontal">
                                <CheckBox x:Name="checkboxMale" Content="{x:Static p:Resources.Male}" Checked="checkboxMale_Checked" />
                                <StackPanel Width="10" />
                                <CheckBox x:Name="checkboxFemale" Content="{x:Static p:Resources.Female}" Checked="checkboxFemale_Checked" />
                            </StackPanel>

                            <StackPanel Grid.Column="2" Grid.Row="4" Orientation="Horizontal" >
                                <TextBox Margin="{StaticResource margin}" x:Name="txtAge" HorizontalAlignment="Left"  Width="35" PreviewTextInput="txtAge_PreviewTextInput" LostFocus="txtAge_LostFocus" />
                                <TextBlock Margin="10, 0, 5, 0" Text="Age unit:" />
                                <ComboBox x:Name="cmbAgeUnit" IsEditable="False" SelectedIndex="-1" Width="65">
                                    <ComboBoxItem>
                                        <TextBlock Text=""/>
                                    </ComboBoxItem>
                                    <ComboBoxItem>
                                        <TextBlock Text="{x:Static p:Resources.AgeUnitYears}"/>
                                    </ComboBoxItem>
                                    <ComboBoxItem>
                                        <TextBlock Text="{x:Static p:Resources.AgeUnitMonths}"/>
                                    </ComboBoxItem>
                                </ComboBox>
                            </StackPanel>
                            <TextBox Margin="{StaticResource margin}" x:Name="txtHeadHousehold" Grid.Column="2" HorizontalAlignment="Left" Grid.Row="5" Width="140" />
                            
                            <ComboBox Grid.Row="6" Margin="{StaticResource margin}" ItemsSource="{Binding Districts}" x:Name="cmbDistrict" Grid.Column="2" IsEditable="True" HorizontalAlignment="Left"  Width="140" SelectionChanged="cmbDistrict_SelectionChanged" />
                            <!-- add textbox for dirict here  -->
                            <TextBox Grid.Row="6" Margin="{StaticResource margin}"    x:Name="txtDistrict" Grid.Column="2"  HorizontalAlignment="Left"  Width="140"   />
                            
                            <ComboBox Grid.Row="7" x:Name="cmbSubCounty" Grid.Column="2" IsEditable="True" HorizontalAlignment="Left" Width="140" Height="22" VerticalAlignment="Bottom" />
                            <TextBox Grid.Row="7" Margin="{StaticResource margin}"    x:Name="txtSubCounty" Grid.Column="2"  HorizontalAlignment="Left"  Width="140"   />
                            
                            <ComboBox Grid.Row="8" Margin="{StaticResource margin}" ItemsSource="{Binding Villages}" x:Name="cmbVillage" Grid.Column="2" IsEditable="True" HorizontalAlignment="Left" Width="140" />
                            <TextBox Grid.Row="8" Margin="{StaticResource margin}"    x:Name="txtVillage" Grid.Column="2"  HorizontalAlignment="Left"  Width="140"   />
                            
                            <TextBox Margin="{StaticResource margin}" x:Name="txtLC1Chairman" Grid.Column="2" HorizontalAlignment="Left" Grid.Row="9" Width="140" />
                            <TextBox Margin="{StaticResource margin}" x:Name="txtPhoneNumber" Grid.Column="2" HorizontalAlignment="Left" Grid.Row="10" Width="140" />
                            <!--<TextBox Margin="{StaticResource margin}" x:Name="txtHCW" Grid.Column="2" HorizontalAlignment="Left" Grid.Row="10" Width="120" />-->

                            <StackPanel Margin="{StaticResource margin}" Grid.Column="2" Grid.Row="11" Orientation="Horizontal">
                                <CheckBox x:Name="checkboxHCWYes" Content="{x:Static p:Resources.Yes}" Checked="checkboxHCWYes_Checked" />
                                <StackPanel Width="10" />
                                <CheckBox x:Name="checkboxHCWNo" Content="{x:Static p:Resources.No}" Checked="checkboxHCWNo_Checked" />
                            </StackPanel>

                            <TextBox Margin="{StaticResource margin}" x:Name="txtHCWFacility" Grid.Column="2" HorizontalAlignment="Left" Grid.Row="12" Width="140"
                             IsEnabled="{Binding ElementName=checkboxHCWYes, Path=IsChecked}" />
                            <TextBox Margin="0,0,0,2" x:Name="txtTeam" Grid.Column="2" HorizontalAlignment="Left" Grid.Row="13" Width="140" Height="22" VerticalAlignment="Bottom" />

                            <TextBox Visibility="Collapsed" IsEnabled="False" Margin="{StaticResource margin}" x:Name="txtRiskLevel" Grid.Column="2" HorizontalAlignment="Left" Grid.Row="14" Width="140" />
                            <!--<TextBox Margin="{StaticResource margin}" x:Name="txtFinalOutcome" Grid.Column="2" HorizontalAlignment="Left" Grid.Row="14" Width="120" />-->

                            <StackPanel x:Name="panelFinalOutcome" Margin="{StaticResource margin}" Grid.Column="2" Grid.Row="16" Orientation="Vertical">
                                <CheckBox x:Name="checkboxFO_Discharged" Content="{x:Static p:Resources.AnalysisDischargedFollowUp}" Checked="checkboxFO_Discharged_Checked" />
                                <StackPanel Width="10" />
                                <CheckBox x:Name="checkboxFO_Isolated" Content="{x:Static p:Resources.AnalysisDevelopedSymptomsIso}" Checked="checkboxFO_Isolated_Checked" />
                                <StackPanel Width="10" />
                                <CheckBox x:Name="checkboxFO_Dropped" Content="{x:Static p:Resources.AnalysisDroppedFollowUp}" Checked="checkboxFO_Dropped_Checked" />
                            </StackPanel>

                            <TextBlock Visibility="Collapsed" Grid.Row="17" Text="{x:Static p:Resources.HTMLColHeaderNotes}" />
                            <TextBox Visibility="Collapsed" x:Name="txtNotes" Margin="{StaticResource margin}" HorizontalAlignment="Left" Width="230" Height="100" Grid.Column="2" Grid.Row="17"></TextBox>
                        </Grid>
                    </StackPanel>
                </StackPanel>
            </ScrollViewer>
            <StackPanel Grid.Row="1" Grid.Column="0" Margin="0, 0, 0, 0" x:Name="panelRelationshipInfo" Visibility="Collapsed">
                <TextBlock Margin="0, 10, 0, 0" x:Name="tblockRelationship" Style="{StaticResource Heading2}"
                       Text="{x:Static p:Resources.RelationshipInformation}" />

                <StackPanel x:Name="panelRelationship" Margin="0,0,10,0" Height="Auto" HorizontalAlignment="Left" Visibility="Visible" Orientation="Horizontal">
                    <StackPanel>
                        <Label Content="{x:Static p:Resources.DateLastContact}"/>
                        <DatePicker x:Name="dateContact" Width="170" HorizontalAlignment="Left"></DatePicker>
                        <!--<Calendar x:Name="calendarContact" HorizontalAlignment="Left" SelectedDate="" />-->

                        <CheckBox Margin="0, 10, 0, 4" x:Name="cbxEstimated" Content="{x:Static p:Resources.DateEstimated}"/>

                        <Label Content="{x:Static p:Resources.ContactRelationship}"/>
                        <TextBox x:Name="txtRelationship" HorizontalAlignment="Left" Width="180"></TextBox>

                        <Label Content="{x:Static p:Resources.ContactType}"/>
                        <StackPanel>
                            <CheckBox x:Name="cbxCon1" Margin="0,2,0,0" Content="{x:Static p:Resources.TypeTouchedFluid}"/>
                            <CheckBox x:Name="cbxCon2" Margin="0,2,0,0" Content="{x:Static p:Resources.TypePhysicalContact}"/>
                            <CheckBox x:Name="cbxCon3" Margin="0,2,0,0" Content="{x:Static p:Resources.TypeSharedClothes}"/>
                            <CheckBox x:Name="cbxCon4" Margin="0,2,0,0" Content="{x:Static p:Resources.TypeSameRoom}"/>
                        </StackPanel>
                    </StackPanel>
                </StackPanel>

            </StackPanel>

            <StackPanel Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" Orientation="Horizontal" HorizontalAlignment="Right">
                <Button Margin="5" x:Name="btnSave" MinWidth="120" Content="Save" IsEnabled="{Binding IsLoadingProjectData, Converter={StaticResource BooleanInverter}}" Click="btnSave_Click" />
                <Button Margin="5" x:Name="btnCancel" MinWidth="120" Content="Cancel" Click="btnCancel_Click" />
            </StackPanel>

            <!--<Rectangle x:Name="rectangleSplitter" Grid.Column="1" Width="1" HorizontalAlignment="Left" Grid.Row="1" Margin="0, 1, 0, 1" Stroke="Gray" Fill="Transparent" StrokeThickness="1" StrokeDashArray="1.5 1.5 1.3" />-->
        </Grid>
    </Border>
</UserControl>
